home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / ctlib100.zip / INSTALL.LZH / CTTABLES.INT < prev    next >
Text File  |  1996-10-12  |  4KB  |  106 lines

  1. {**************************************************************************}
  2. {*  BitSoft Development, L.L.C.                                           *}
  3. {*  Copyright (C) 1995, 1996 BitSoft Development, L.L.C.                  *}
  4. {*  All rights reserved.                                                  *}
  5. {*  Table structures unit                                                 *}
  6. {*  Version 2.4.2                                                         *}
  7. {**************************************************************************}
  8.  
  9. unit ctTables;
  10.  
  11. {$X+}
  12.  
  13. interface
  14.  
  15. uses Objects,
  16.      {$ifdef Ver60} BsdVer60, {$endif Ver60}
  17.      Containr, ctTypes, ctFields;
  18.  
  19. type
  20.   PTable = ^TTable;
  21.   TTable = object(TSequence)
  22.       Stream : PStream;
  23.       StartPos : LongInt;
  24.       Structure : PFieldStructure;
  25.       RowSize : Word;
  26.       DeletedRows : LongInt;
  27.       HeaderSize : Word;
  28.       IsDeleted : Boolean;
  29.     constructor Init (AStructure : PFieldStructure; AStream : PStream);
  30.     constructor Open (AStream : PStream);
  31.     destructor Done; virtual;
  32.     function ActiveRows : LongInt;
  33.     function At (Index : LongInt) : Pointer; virtual;
  34.     function AtDelete (Index : LongInt) : Boolean; virtual;
  35.     function AtField (Index : LongInt; AField : Integer; MaxLen : Word;
  36.       P : PChar) : Boolean; virtual;
  37.     function AtFree (Index : LongInt) : Boolean; virtual;
  38.     function AtInsert (Index : LongInt; Item : Pointer) : Boolean; virtual;
  39.     function AtItem (Index : LongInt; Offset : Word; MaxLen : Word;
  40.       P : PChar) : Boolean;
  41.     function AtPut (Index : LongInt; Item : Pointer) : Boolean; virtual;
  42.     function AtPutField (Index : LongInt; AField : Integer; Len : Word;
  43.       P : PChar) : Boolean; virtual;
  44.     function AtPutItem (Index : LongInt; Offset : Word; Len : Word;
  45.       P : PChar) : Boolean; virtual;
  46.     function AtUnDelete (Index : LongInt) : Boolean; virtual;
  47.     function CalcHeaderSize : LongInt; virtual;
  48.     function DeleteAll : Boolean; virtual;
  49.     procedure DoneItem(Item : Pointer); virtual;
  50.     function FieldOffset (AField : LongInt) : Word; virtual;
  51.     function ForEach (Action : Pointer) : Boolean; virtual;
  52.     function ForEachThat (Test, Action : Pointer) : Boolean; virtual;
  53.     function FreeAll : Boolean; virtual;
  54.     procedure FreeItem (Item : Pointer); virtual;
  55.     function GetItem (var S : TStream) : Pointer; virtual;
  56.     function IndexOf (Item : Pointer) : LongInt; virtual;
  57.     function Pack : Boolean; virtual;
  58.     procedure PutItem (var S : TStream; Item : Pointer); virtual;
  59.     procedure ReadHeader; virtual;
  60.     procedure ReadStructure; virtual;
  61.     procedure Reset; virtual;
  62.     function RowOffset (Index : LongInt) : LongInt; virtual;
  63.     function Search (Key : Pointer; var Index : LongInt) : Boolean; virtual;
  64.     procedure Seek (Index : LongInt); virtual;
  65.     procedure ShowInfo (var Device : Text); virtual;
  66.     function UnDelete (Index : LongInt) : Boolean; virtual;
  67.     function ValidFieldStructure (AStructure : PFieldStructure) : Boolean;
  68.       virtual;
  69.     function ValidStream (AStream : PStream) : Boolean; virtual;
  70.     procedure WriteHeader; virtual;
  71.     procedure WriteStructure; virtual;
  72.     function Zap : Boolean; virtual;
  73.   private
  74.     procedure WriteItem (Index : LongInt; Item : Pointer);
  75.   end;  { TTable }
  76.  
  77. type
  78.   PObjectTable = ^TObjectTable;
  79.   TObjectTable = object(TTable)
  80.     function CalcHeaderSize : LongInt; virtual;
  81.     procedure FreeItem (Item : Pointer); virtual;
  82.     function GetItem (var S : TStream) : Pointer; virtual;
  83.     procedure PutItem (var S : TStream; Item : Pointer); virtual;
  84.     procedure ReadHeader; virtual;
  85.     function RowOffset (Index : LongInt) : LongInt; virtual;
  86.     procedure WriteHeader; virtual;
  87.   end;  { TObjectTable }
  88.  
  89. const
  90.   TableSig : array[0..3] of Char = 'DBMS';
  91.  
  92.   TableVersion : Word = $0100;
  93.  
  94.   ObjectTableSig : array[0..4] of Char = 'ODBMS';
  95.  
  96.   ObjectTableVersion : Word = $0100;
  97.  
  98.   ActiveRow : Char = ' ';
  99.  
  100.   DeletedRow : Char = '*';
  101.  
  102.   EOF : Byte = $1A;
  103.  
  104. implementation
  105. end.
  106.